@extends('layouts.default')
@section('css')
    <link rel="stylesheet" href="{{asset('admin-lte/plugins/datatables/dataTables.bootstrap4.css')}}">
    {{--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">--}}
    <link rel="stylesheet" href="{{asset('admin-lte/plugins/datetimepicker/css/bootstrap-datetimepicker.css')}}">

@stop

@section('content')
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-header">
                    <h3 class="card-title">用户反馈管理/ <a class="text-primary" href="{{url('admin/FeedBack/index')}}">反馈列表</a></h3>
                </div>
                <div class="row">
                    <div style="width: 98.5%">
                        <div class="pull-right">
                            <div class="col-12">
                                <form action="#" class="form-inline" onsubmit="return false;">
                                    <div class="form-group" style="margin-left: 15px" id="search_box">
                                        <label for="begin_time" class="sr-only">开始时间：</label>
                                        <input type="text" class="form-control" id="begin_time" style="text-align: left;display: block" placeholder="开始时间" value="{{isset($search)??getSearchTime($search)['begin_time']}}" >
                                    </div>
                                    <div class="form-group" style="margin-left: 15px" id="search_box">
                                        <label for="end_time" class="sr-only">结束时间：</label>
                                        <input type="text" class="form-control" id="end_time" style="text-align: left;display: block" placeholder="结束时间" value="{{isset($search)??getSearchTime($search)['end_time']}}">
                                    </div>
                                    <button class="btn-info" style="margin-left: 3px;display: block" id="searchBtn">搜索</button>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            @include('layouts.message')
            <!-- /.card-header -->
                <div class="card-body">
                    <table id="example1" class="table table-bordered table-striped">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>用户名</th>
                            <th>用户昵称</th>
                            <th>联系方式</th>
                            <th>内容</th>
                            <th>提交时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach ($lists as $list)
                            <tr>
                                <td>{{ $list['sug_id'] }}</td>
                                <td>{{ $list['user_name'] }}</td>
                                <td>{{ $list['user_nickname'] }}</td>
                                <td>{{ $list['phone'] }}</td>
                                <td>{{ $list['content'] }}</td>
                                <td>{{ $list['created_at'] }}</td>
                            </tr>
                        @endforeach
                        </tbody>
                        <tfoot>
                        <tr>
                            {{--<th>红包总数：</th>--}}
                            {{--<th>{{$count}}</th>--}}
                            {{--<th>红包总金额：</th>--}}
                            {{--<th>{{$total.'   CNY'}}</th>--}}
                            {{--<th>红包限制金额：</th>--}}
                            {{--<th><button id="red_bag_total_amount" class="btn-info">{{($red_bag_conf['conf_val']??0)}}</button>&nbsp;&nbsp;&nbsp;&nbsp;CNY</th>--}}
                        </tr>
                        </tfoot>
                    </table>

                </div>
                <!-- /.card-body -->
            </div>
            <!-- /.card -->
        </div>
        <!-- /.col -->
    </div>
    <input type="hidden" value="{{$search['key']??''}}" id="key">
@stop

@section('script')
    <script src="{{asset('admin-lte/plugins/datatables/jquery.dataTables.js')}}"></script>
    <script src="{{asset('admin-lte/plugins/datatables/dataTables.bootstrap4.js')}}"></script>
    {{--引入bootstrap datetimepicker插件--}}
    <script src="{{asset('admin-lte/plugins/datetimepicker/js/bootstrap-datetimepicker.js')}}"></script>
    <script src="{{asset('admin-lte/plugins/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js')}}"></script>
    <script>
        $(function () {
            $("#example1").DataTable({
                "language"  : {
                    url :'https://cdn.datatables.net/plug-ins/1.10.19/i18n/Chinese.json',
                },
                "lengthChange": false,
                "searching": false,
            });

                    $("#begin_time").datetimepicker({//选择年月日
                        format: 'yyyy-mm-dd hh:ii:ss',
                        language: 'zh-CN',
                        weekStart: 1,
                        todayBtn: 1,//显示‘今日’按钮
                        autoclose: 1,
                        todayHighlight: 1,
                        startView: 2,
                        minView: 0,  //Number, String. 默认值：0, 'hour'，日期时间选择器所能够提供的最精确的时间选择视图。
                        clearBtn:true,//清除按钮
                        forceParse: 0
                    });

                    $("#end_time").datetimepicker({//选择年月日
                        format: 'yyyy-mm-dd hh:ii:ss',
                        language: 'zh-CN',
                        weekStart: 1,
                        todayBtn: 1,//显示‘今日’按钮
                        autoclose: 1,
                        todayHighlight: 1,
                        startView: 2,
                        minView: 0,  //Number, String. 默认值：0, 'hour'，日期时间选择器所能够提供的最精确的时间选择视图。
                        clearBtn:true,//清除按钮
                        forceParse: 0
                    });
                //  搜索
                    $("#searchBtn").on('click',function () {
                        let  search_val                 = new Object();
                        search_val ['begin_time']       = $('#begin_time').val();
                        search_val ['end_time']         = $('#end_time').val();
                        let url                         = location.href;
                        url = url.split('?')[0];
                        if ( search_val!== ''){
                            let newUrl                  = `${url}?key=created_at&val=${JSON.stringify(search_val)}`;
                            location.href               =   newUrl;
                        }else {
                            location.href               =   url;
                        }
                    })
        });

    </script>
@stop